home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
United Public Domain Gold 2
/
United Public Domain Gold 2.iso
/
utilities
/
pu478.dms
/
pu478.adf
/
CONVERT
/
Convert.doc
< prev
next >
Wrap
Text File
|
1993-09-02
|
7KB
|
172 lines
Convert Documentation
Usage
-----
Convert may be used from CLI only.
Below is what Convert would output if called with the wrong # of
arguments or '?' as the first argument.
Usage: Convert # <from unit> [ [to] <to unit> ]
where # is a number ( possibly 1 ),
<from unit> is the units to be converted from
<to unit> is the units to be converted to
if <to unit> is not supplied, then a list of
all units of similar kind will be output
Convert ? produces this list
See conv.dat (required in the current directory)
for valid units
conv.dat is an ASCII file that may be added to
provided the format is correct (See docs)
Any of the Items or Synonyms below may be used with the conv.dat
supplied.
Distribution and copyright
--------------------------
Convert may be freely copied and distributed as long as no charges
are made other than to cover the time, copying costs and mailing costs.
Please don't distribute Convert without its accompanying doc file.
Archiving and crunching are allowed. I retain the copyright to it(1993).
I assume no responsibility of damage done to your hardware or software
which the use of Convert may cause. Its use is totally your own
responsibility.
The above is just for the record. I don't expect Convert to do any
damage to hardware or software. I have used it for some time with no
problems.
Personalization
---------------
Adding items to conv.dat ( or making a new one ) requires that you to
adhere to certain conventions. First, any items that you wish to use
that appear in Item (below) must be put into conv.dat as the corresponding
item in synonym. Second, if a new category is created, no item in Item may
be used alone, as it won't be found ( in the current conv.dat, at least as
all Items are already used ). When a new category is created, it should
consist of three lines: the category name( one string [ use '_' if
necessary] ), a list of unit names and a list of unit numerical
correspondences. The item names in conv.dat are limited to 29 characters.
( Used to be 19, but I ran into weird symptoms and a difficult-to-find
cause. ) Command-line names may be up to 39 characters long. Up to 24
items may appear in a category, but they need not be on the same line.
They must, however be consecutive. ALL the names must appear first, then
the numbers, which also do not need to be on the same line. As an example
compare the following with the first 3 lines of the supplied conv.dat.
Length
in ft yd cm m Km statute_mi
nautical_mi pars light-yr mil un mun angstrom
x-unit rod fathom furlong
1 8.333333e-2 2.777777e-2 2.54 2.54e-2 2.54e-6 1.578283e-5
1.371604e-5 8.235655e-19 2.684858e-18 1e3 2.54e4 2.54e7 2.54e8
2.54e11 5.050505e-3 1.388888e-2 1.262626e-4
I find the single-line form easier to follow, but the above works just
as well. Note that numbers may be put in integer, floating point or
scientific notation. Names may NOT begin with a number(very important).
Note that it is not just miles, but either statute_miles or
nautical_miles. The statute or nautical MUST be specified. In any case
where the program apparently fails, check conv.dat for proper spelling.
Don't put spaces in names ( use '_' or '-' ) unless you enjoy using
double quotes around your strings. Remember, this would also require
double quotes when Convert was used and when the corresponing names were
put into conv.dat.
Probably the hardest thing to do right is the numerical
correspondences. Make sure they are 'pointing the right way' as well as
being the right number. The first number in a category is always 1(one),
and all the rest are relative to that unit. Hint: if the largest unit is
put first, all the others will be > 1. Another way to think of it is that
the number below an item is the number of that item in the first item
( i.e. if the item is smaller than the first, its multiplier will be
larger than one. ). I didn't do that with the supplied conv.dat as you
may have noticed - Too soon old und too late schmart!
Note: Some items below appear twice, once as you would expect, and
again with a trailing '*' to indicate a second category. An example of
this is pound and pound* to denote respectively mass and force. Their
synonyms are lb and lb*. Some units in conv.dat may look strangely
spelled, i.e. pars for parsec. This is because the synonym converter
replaces 'sec' with 's'. This was intended for things quite different,
but once there, this action must be accounted for.
Item Synonym
barrel bbl
calorie cal
celsius c
centi c
century cent
centurie cent
circular cir
cubic cu
day dy
decade dec
degree deg
electron e
pound* lb*
fahrenheit f
feet ft
foot ft
gallon gal
gram g
horsepower hp
hour hr
inche in
inch in
kilo k
knot kt
liter l
litre l
mercury hg
meter m
metre m
mega m
micro u
mile mi
milli m
minute* min*
month mo
newton n
ounce oz
pound lb
radian rad
revolution rev
minute min
second* s*
second s
square sq
volt v
water h2o
watt w
yard yd
year yr
sec* s*
sec s
As can be seen, Items can have the same synonym. However the reverse
is not true.
History
-------
Covvert was inspired by Units( by Gregory Simpson ) but I wanted a
program that was easier to use and could be customized by changing the
data file ( conv.dat ) alone and would not require re-compilation of the
program. Consquently, I used nothing from Units but the idea of converting
from one unit to another.
Another wish was to be able to use full names of units or plurals if
desired without having to use them in the data file.
Compiled with DICE v2.06.39. This version: 1.3 - 1/21/93
David Whitmore
32 Oakridge Ave.
Natick, MA 01760
Sorry, I don't have an address on any bulletin boards, only USnail :-)